import usbrelay_py

def control_relays():
    count = usbrelay_py.board_count()
    print("Count: ", count)

    boards = usbrelay_py.board_details()
    print("Boards: ", boards)

    for board in boards:
        print("Board: ", board)
        relay = 1
        while relay < board[1] + 1:
            result = usbrelay_py.board_control(board[0], relay, 1)
            print("Result: ", result)
            relay += 1

        relay = 1
        while relay < board[1] + 1:
            result = usbrelay_py.board_control(board[0], relay, 0)
            print("Result: ", result)
            relay += 1


if __name__ == "__main__":
    control_relays()
